<?php
    class Debug{
        protected $debug;
        function __construct(){
            $this->debug = true;
        }
        function debug($data){
            if($this->debug){
                $trace = debug_backtrace();
                $line_no = $trace[0]['line'];
                echo "<pre>";
                    echo "Line No : $line_no <br />";
                    if(is_array($data)){
                        print_r($data);
                    }
                    else{
                        echo $data;
                    }
                echo "</pre>";
                //debug_print_backtrace();
            }
        }
    }
?>
<?php
    $class_obj = new Debug();
    $class_obj->debug("Test");
    
    
    
    
    $class_obj->debug(array("dfsdfsdf","Sdfsdf"));
?>